Skip to main content

BlendFunc Class

Description:

  A class for creating BlendFunc objects.

BlendFunc.Func

Type: Enumeration.

Description:

  An enum defining blend functions.

Signature:

enum Func

-- The source color is multiplied by 1 and added to the destination color (essentially, the source color is drawn on top of the destination color).
"One"

-- The source color is multiplied by 0 and added to the destination color (essentially, the source color has no effect on the destination color).
"Zero"

-- The source color is multiplied by the source alpha, and added to the destination color multiplied by the inverse of the source alpha.
"SrcColor"

-- The source alpha is multiplied by the source color, and added to the destination alpha multiplied by the inverse of the source alpha.
"SrcAlpha"

-- The destination color is multiplied by the destination alpha, and added to the source color multiplied by the inverse of the destination alpha.
"DstColor"

-- The destination alpha is multiplied by the source alpha, and added to the source alpha multiplied by the inverse of the destination alpha.
"DstAlpha"

-- Same as "SrcColor", but with the source and destination colors swapped.
"InvSrcColor"

-- Same as "SrcAlpha", but with the source and destination alphas swapped.
"InvSrcAlpha"

-- Same as "DstColor", but with the source and destination colors swapped.
"InvDstColor"

-- Same as "DstAlpha", but with the source and destination alphas swapped.
"InvDstAlpha"
end

get

Type: Function.

Description:

  Gets the integer value of a blend function.

Signature:

get: function(self: BlendFuncClass, func: Func): integer

Parameters:

ParameterTypeDescription
funcFuncThe blend function to get the value of.

Returns:

Return TypeDescription
integerThe integer value of the specified blend function.

__call

Type: Metamethod.

Description:

  Creates a new BlendFunc instance with the specified source and destination factors.

Signature:

metamethod __call: function(self: BlendFuncClass, src: Func, dst: Func): BlendFunc

Parameters:

ParameterTypeDescription
srcFuncThe source blend factor.
dstFuncThe destination blend factor.

Returns:

Return TypeDescription
BlendFuncThe new BlendFunc instance.

__call

Type: Metamethod.

Description:

  Creates a new BlendFunc instance with the specified source and destination factors for color and alpha channels.

Signature:

metamethod __call: function(self: BlendFuncClass, srcColor: Func, dstColor: Func, srcAlpha: Func, dstAlpha: Func): BlendFunc

Parameters:

ParameterTypeDescription
srcColorFuncThe source blend factor for the color channel.
dstColorFuncThe destination blend factor for the color channel.
srcAlphaFuncThe source blend factor for the alpha channel.
dstAlphaFuncThe destination blend factor for the alpha channel.

Returns:

Return TypeDescription
BlendFuncThe new BlendFunc instance.

default

Type: Readonly Field.

Description:

  The default blend function. Equals to BlendFunc("SrcAlpha", "InvSrcAlpha", "One", "InvSrcAlpha")

Signature:

const default: BlendFunc